package com.bestv.engine.recommender;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by Henry on 14-7-24.
 */
public class RecommenderRouter {
    private String name;
    private String method;
    private Set<Integer> typeIds;
    private Set<String> userGroups;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public Set<Integer> getTypeIds() {
        return typeIds;
    }

    public void setTypeIds(String typeIds) {
        if (StringUtils.isNotBlank(typeIds)) {
            this.typeIds =  new HashSet<Integer>();
            for (String typeId : typeIds.split(",")) {
                this.typeIds.add(Integer.valueOf(typeId));
            }
        }
    }

    public Set<String> getUserGroups() {
        return userGroups;
    }

    public void setUserGroups(String userGroups) {
        if (StringUtils.isNotBlank(userGroups)) {
            this.userGroups = new HashSet<String>(Arrays.asList(userGroups.split(",")));
        }
    }
}
